function post(data, url) {
    data = JSON.stringify(data);
    if (url.startsWith("https:")) {
        http = require("https");
    } else {
        http = require("http");
    }
    let opt1 = {
        method: "POST",
        headers: {
            "Content-Type": 'application/json',
            "Content-Length": Buffer.byteLength(data)
        }
    };
    return new Promise(function (a, r) {
        var req = http.request(url, opt1, function (res) {
            let { statusCode } = res;
            var body = '';
            res.on('data', function (d) {
                body += d;
            }).on('end', function () {
                let resInfo = {
                    statusCode:statusCode,
                    body:body
                }
                if(statusCode>=300||statusCode<200){d
                    r(JSON.stringify(resInfo))
                }else {
                    a(JSON.stringify(resInfo))
                }
            });
        });
        req.on('error', (e) => {
            r(e);
        });
        req.write(data);
        req.end();
    })
}

let data = {
    "validBegin": 1621500642,
    "validTime": 1200000,
    "signature": "1AC85CB317DADA4864FFF213AE86BB086AE5A13B",
    "meetingId": "EKKKe4320005",
    "meetingType": "public",
    "appId": "dingdingtest",
    "callback": "https://dear.client.com/callback",
    "mediaType": "video",
    "duration": 7841,
    "userCount": 27,
    "listenerCount": 26,
    "speakerCount": 1,
    "userCS": 1212,
    "teacherCS": 7849,
    "speakerShareTime": 758,
    "listenerShareTime": 18069,
    "beginTime": 1521500642,
    "endTime": 1521600642,
    "recordBegin": 1521500642,
    "dirname": "/some/dir",
    "recordAvator": "sfdf-ddfd-fffg-223-df34",
    "videoStream": 3,
    "richMedia": true,
    "cover": "",
    "statistics": [
        {
            "id": "sfdf-ddfd-fffg-223-df34",
            "crowd": 1,
            "logCount": 2,
            "nHeatBeat": 0,
            "autoOut": 0,
            "socketClose": 0,
            "seq": 1,
            "prefix": 100000,
            "testStar": 0,
            "awardStar": 0,
            "answerDuration": 0,
            "uniqueId": "sfdf-ddfd-fffg-223-df34",
            "handUpCount": 0,
            "joinClassTime": 1594511352502,
            "leaveClassTime": 1594519202000,
            "roleType": "speaker",
            "name": "张三",
            "isSpeaker": true,
            "online": false,
            "addr": "::ffff:121.28.85.34:53699",
            "resource": "Chrome 83.0.4103.106(pc)",
            "mediaConnectionDelay": 601,
            "agoraUid": 12,
            "idInMedia": 12,
            "shareStreamTimer": {
                "__total": 758783,
                "__paused": true,
                "__begin": 1594514989684
            },
            "onstageDuration": 7849,
            "onlineDuration": 7849,
            "faceDuration": 7340
        },
        {
            "id": "dfddf-7445-41-dfdf-agdgdgd",
            "crowd": 1,
            "logCount": 6,
            "nHeatBeat": 0,
            "autoOut": 0,
            "socketClose": 4,
            "seq": 2,
            "prefix": 200000,
            "testStar": 0,
            "awardStar": 1,
            "answers": [],
            "answerDuration": 0,
            "uniqueId": "dfddf-7445-41-dfdf-agdgdgd",
            "handUpCount": 0,
            "joinClassTime": 1594511718775,
            "leaveClassTime": 1594519202002,
            "roleType": "listener",
            "name": "李四",
            "online": false,
            "addr": "::ffff:183.198.133.159:3609",
            "resource": "OPPO 5.1(android)",
            "mediaConnectionDelay": 190,
            "agoraUid": 13,
            "idInMedia": 13,
            "shareStreamTimer": {
                "__total": 758783,
                "__paused": true,
                "__begin": 1594514989684
            },
            "onstageDuration": 282,
            "onlineDuration": 7414,
            "faceDuration": 281
        }
    ],
    "refFiles": [],
    "attachment": 1,
    "recordId": "5fsd4dd8db81a25a44200643",
    "saved": true,
    "topic": "",
    "hasMedia": true,
    "fileSize": 304793833,
    "fileLocation": "/some/location",
    "_id": "sfsffwefwfwsfsdfsdf"
}

post(data,"https://dev.plaso.cn/dingapi/dingboss/sdkRecall/liveClassRecall")
post(data,"https://app70292.eapps.dingtalkcloud.com/dingapi/dingboss/sdkRecall/liveClassRecall")

